package com.ar4j.bench.test.simplejdbc;

import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.transaction.TransactionConfiguration;

import com.ar4j.bench.common.domain.ICategory;
import com.ar4j.bench.common.domain.IItem;
import com.ar4j.bench.common.domain.IProduct;
import com.ar4j.bench.common.service.ICategoryService;
import com.ar4j.bench.common.service.IProductService;
import com.ar4j.bench.jdbc.domain.Category;
import com.ar4j.bench.jdbc.domain.Item;
import com.ar4j.bench.jdbc.domain.Product;
import com.ar4j.bench.simplejdbc.service.CategorySimpleJdbcService;
import com.ar4j.bench.simplejdbc.service.ProductSimpleJdbcService;
import com.ar4j.bench.test.synthetic.AbstractSyntheticBenchmarkTest;

/**
 * A JUnit test for running the full benchmark suite for Spring's SimpleJdbc libary.
 */
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = { "/applicationContext-junit.xml" })
@TransactionConfiguration(transactionManager = "txManager", defaultRollback = false)
public class SimpleJdbcSyntheticBenchmark extends AbstractSyntheticBenchmarkTest {
  
  @Autowired
  private CategorySimpleJdbcService categoryService;
  
  @Autowired
  private ProductSimpleJdbcService productService;
  
  @Override
  protected Class<? extends ICategory> getCategoryBaseClass() {
    return Category.class;
  }

  @Override
  protected ICategoryService getCategoryService() {
    return categoryService;
  }

  @Override
  protected Class<? extends IItem> getItemBaseClass() {
    return Item.class;
  }

  @Override
  protected String getName() {
    return "SimpleJdbc";
  }

  @Override
  protected Class<? extends IProduct> getProductBaseClass() {
    return Product.class;
  }

  @Override
  protected IProductService getProductService() {
    return productService;
  }


}
